package com.wtcrazy.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wtcrazy.entity.*;
import io.swagger.models.auth.In;
import net.sf.json.JSONObject;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

//数据持久化层【只是个接口,具体实现在xml中】
@Mapper//标注于接口的上方，用于框架寻找接口和对应接口的xml文件
public interface UserMapper extends BaseMapper<User> {//BaseMapper<User>是MybatisPlus的使用

    User loginUsername(@Param("user") User user);

    User loginMail(@Param("user") User user);

    void deleteShop(String uid);//用户删除自己的订单、地址、用户表

    Integer queryMail(String mail);

    Integer queryUsername(String username);

    void register(@Param("user") User user);//增删改不需要返回东西

    void updatePassword(@Param("obj") Object obj);

    List<Object> getAllPosts();

    List<Object> getLimitPosts(Map<String, Integer> map);

    List<Object> getLimitHotPosts(Map<String, Integer> map);

    List<Object> getAllHotPosts();

    Post getPost(@Param("id") String id);

    void uploadPost(@Param("post") Post post);

    void deletePost(@Param("postid") String postid);

    void addPostView(@Param("id") String id);

    PostLike isLikePost(@Param("postlike") PostLike postLike);

    void likePost(@Param("postlike") PostLike postLike);

    void unLikePost(@Param("postlike") PostLike postLike);

    void updatePostLike(@Param("obj") JSONObject obj);

    void updatePostComment(@Param("obj") JSONObject obj);

    List<String> getMyPosts(@Param("uid") String uid);

    List<Object> getLimitMyPosts(@Param("obj") Object obj);

    List<Object> getLimitMyHotPosts(@Param("obj") Object obj);

    void deletePostLike(@Param("postid") String postid);

    void updateUserInfo(@Param("obj") Object obj);

    List<PostLike> getUserAllLikePosts(@Param("obj") Object obj);

    void submitComment(@Param("comment") Comment comment);

    List<Comment> getAllCommment(@Param("id") String id);

    List<Comment> getAllSecondCommment(@Param("postId") String postId, @Param("replyCommentId") String replyCommentId);

    void deleteComment(@Param("obj") Object obj);

    void changePostComment(@Param("obj") Object obj);

    List<Comment> getUserComment(@Param("obj") Object obj);

    void deletePostComment(@Param("postid") String postid);

    List<Article> getLimitArticle(Integer classid, Integer start, Integer pageSize);

    Article getArticle(String id);

    Integer querySecondCommentNum(String commentId);

    Integer getUserInfoLike(String uid);

    Integer getUserInfoPost(String uid);

    Integer getUserInfoComment(String uid);

}

